<template>
	<view class="container">
		<view class="box">
			<view class="cover">
				<image :src="cover" mode="widthFix" show-menu-by-longpress></image>
			</view>
			<view class="">
				<view class="button" @click="saveQRCode">
					保存二维码
				</view>
				<view class="button mgt-20" @click="copy">
					复制客服微信
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import Vue from 'vue';
	import {
		getConfig
	} from '@/api/index.js';
	export default {
		components: {},
		data() {
			return {
				number: "",
				cover: 'https://bpic.51yuansu.com/pic3/cover/03/73/64/5bef93809b67b_610.jpg?x-oss-process=image/sharpen,100',
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			init() {
				getConfig({
					data: {

					}
				}).then(res => {
					if (res.code == 1) {
						this.cover = res.data.customer_qrcode
						this.number = res.data.customer_wechat
						console.log(this.number, "	this.number");
					}
				})
			},
			copy() {
				console.log(this.number);
				uni.setClipboardData({
					data: this.number,
					success: function() {
						console.log('success');
					}
				});
			},
			saveQRCode() {
				Vue.prototype.$uniApi.saveImage(this.cover)
			}



		}
	}
</script>

<style lang="scss" scoped>
	.container {
		.box {
			width: 600upx;
			height: 70vh;
			background-color: #fff;
			box-shadow: 0 0 8upx #999;
			margin: 0 auto;
			margin-top: 15vh;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-wrap: wrap;

			.cover {
				width: 400upx;
				height: 400upx;

				image {
					width: 100%;
					height: 100%;
				}
			}
		}

		.button {
			color: #fff;
			font-size: 34upx;
			height: 85upx;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: #1e90ff;
			width: 500upx;
			margin: 0 auto;
			margin-top: 30upx;
			border-radius: 10upx;
		}
	}
</style>
